<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.prime.com.tr/ui">

    <ui:composition template="/template.xhtml">
        <ui:define name="title">
            <h:outputText value="#{bundle.CreateSystemUserEntityTitle}"></h:outputText>
        </ui:define>
        <ui:define name="body">
            <h:panelGroup id="messagePanel" layout="block">
                <h:messages errorStyle="color: red" infoStyle="color: green" layout="table"/>
            </h:panelGroup>
            <h:form>
                <h:panelGrid columns="3">
                    <h:outputLabel value="#{bundle.CreateSystemUserEntityLabel_department}" for="department" />
                    <h:selectOneMenu id="department" value="#{systemUserEntityController.selected.department}" title="#{bundle.CreateSystemUserEntityTitle_department}" >
                        <f:selectItems value="#{departmentEntityController.itemsAvailableSelectOne}"/>
                        <f:validator validatorId="macTeam.SystemUserSelectOneMenuValidator" />
                    </h:selectOneMenu>
                    <h:message styleClass="errorMsg" for= "department"/>
                    
                    <h:outputLabel value="UserName" for="name" />
                    <p:inputText id="name" value="#{systemUserEntityController.selected.name}" title="#{bundle.CreateSystemUserEntityTitle_name}" required="true" requiredMessage="UserName is missing" 
                        validator ="#{systemUserEntityController.validateUserName}">
                    </p:inputText>
                    <h:message styleClass="errorMsg" for= "name"/>
                    
                    
                    <h:outputLabel value="#{bundle.CreateSystemUserEntityLabel_password}" for="password" />
                    <p:password id="password" value="#{userManagerBean.password}" minLength="6" feedback="true" required="true" requiredMessage="PassWord is missing">
                    </p:password>
                    <h:message styleClass="errorMsg" for="password" />
                    
                    
                    <h:outputLabel value="#{bundle.CreateSystemUserEntityLabel_firstName}" for="firstName" />
                    <p:inputText id="firstName" value="#{systemUserEntityController.selected.firstName}" title="#{bundle.CreateSystemUserEntityTitle_firstName}" required="true" requiredMessage="First name is missing"/>
                    <h:message styleClass="errorMsg" for= "firstName"/>
                    
                    
                    <h:outputLabel value="#{bundle.CreateSystemUserEntityLabel_lastName}" for="lastName" />
                    <p:inputText id="lastName" value="#{systemUserEntityController.selected.lastName}" title="#{bundle.CreateSystemUserEntityTitle_lastName}" required="true" requiredMessage="Last name is missing" />
                    <h:message styleClass="errorMsg" for= "lastName"/>
                    
                    <h:outputLabel value="#{bundle.CreateSystemUserEntityLabel_title}" for="title" />
                    
                    <h:selectOneMenu id="title" value="#{systemUserEntityController.selected.title}" title="#{bundle.CreateSystemUserEntityTitle_title}" >
                        <f:selectItems value="#{systemUserEntityController.userTitles}"/>
                    </h:selectOneMenu>
                </h:panelGrid>
                <h:message styleClass="errorMsg" for= "title"/>
                
                <h:panelGrid columns="3">
                    <h:outputLabel value="#{bundle.CreateContactEntityLabel_contactNumber}" for="contactNumber" />
                    <p:inputText id="contactNumber" value="#{systemUserEntityController.selected.contact.contactNumber}" title="#{bundle.CreateContactEntityTitle_contactNumber}" required="true" requiredMessage="Contact Number is missing" >
                    <f:validator validatorId="macTeam.ContactNumberValidator" />
                    </p:inputText>
                    <h:message styleClass="errorMsg" for= "contactNumber"/>
                    
                    <h:outputLabel value="#{bundle.CreateContactEntityLabel_email}" for="email" />
                    <p:inputText id="email" value="#{systemUserEntityController.selected.contact.email}" title="#{bundle.CreateContactEntityTitle_email}" required="true" requiredMessage="Email is missing" validator ="#{contactEntityController.validateEmail}">
                    <f:validator validatorId="macTeam.EmailValidator" />
                    </p:inputText>
                    <h:message styleClass="errorMsg" for= "email" />
                    
                </h:panelGrid>
                <br />
                <h:commandLink action="#{systemUserEntityController.create}" value="#{bundle.CreateSystemUserEntitySaveLink}" />
                <br />
                <br />
                <h:commandLink action="#{systemUserEntityController.prepareList}" value="#{bundle.CreateSystemUserEntityShowAllLink}" immediate="true"/>
                <br />
                <br />
                <h:commandLink value="#{bundle.CreateSystemUserEntityIndexLink}" action="/index" immediate="true" />
            </h:form>
        </ui:define>
    </ui:composition>

</html>
